libname in 'c:\local_c\bfeed3';


**for REStat paper, "Breastfeeding and Children's Early Cognitive Outcomes";
**I am going to merge all of the mother and child data sets together now;

data a;
set in.child08;

proc sort;  by c0000100;  run;

data b;
set in.mom08;
proc sort;  by c0000100;  run;

data c;
merge a b;  by c0000100;  run;

proc sort;  by c0000100;  run;

data d;
set in.marst08;  
proc sort;  by c0000100;  run;

data e;
merge c d;  by c0000100;  run;

proc sort;  by c0000100;  run;

*hhrost082 is just for the 6142 subsample, went back and put this in;
data f;
set in.hhrost082;
proc sort;  by c0000100;  run;

data g;
merge e f;  by c0000100;  run;

proc sort;  by c0000100;  run;

data h;
set in.work082;

proc sort;  by c0000100;  run;

data i;
merge g h;  by c0000100;  run;

proc sort;  by r0000100;  run;


data j;
set in.afqt79;

proc sort;  by r0000100;  run;

data k;
merge i j;  by r0000100;

if c0000100 ne .;

proc sort;  by c0000100;  run;

**custom weighting program from CHRR;
data l;
set in.custwt08;

proc sort;  by c0000100;  run;

data m;
merge k l;  by c0000100;  run;

proc sort;  by c0000100;  run;

*custom weight for full sample from pc sas;
data n;
set in.cwtfull08;

proc sort;  by c0000100;  run;

data o;
merge m n;  by c0000100;
if c0000200 ne .;

proc sort; by c0000100;  run;
*now for sibling fixed effects, weight;

data p;
set in.sibwt08;
proc sort;  by c0000100;  run;

data q;
merge o p;  by c0000100;  run;

proc sort;  by c0000100;  run;

*this is for experiment at end, add in more chars.;
data r;
set in.extra08;

proc sort;  by c0000100;  run;

data s;
merge q r;  by c0000100;  run;

proc sort;  by c0000100;  run;

data t;
set in.hhrost08;  
proc sort;  by c0000100;  run;

data in.bfeed08;
merge s t;  by c0000100;  run;

proc means;
run;
